#计算文件夹大小
import os

totalsize=0
def sizeof(dir):
	global totalsize
	dlist=os.listdir(dir)
	for f in dlist:
		file=os.path.join(dir,f)
		if os.path.isfile(file):
			totalsize+=os.path.getsize(file)
		if os.path.isdir(file):
			sizeof(file)
	

sizeof("aa")

print ("文件夹大小为：{}字节".format(totalsize))
